﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _10_Template
{
    abstract class AbstractClass
    {
        public abstract void PrimitiveOpreation1();
        public abstract void PrimitiveOpreation2();

        public void TemplateMethod()
        {
            PrimitiveOpreation1();
            PrimitiveOpreation2();
            Console.WriteLine("模板函数调用");
        }
    }

    class ConcreteClass1 : AbstractClass
    {
        public override void PrimitiveOpreation1()
        {
            Console.WriteLine("模板延迟实现1");
        }

        public override void PrimitiveOpreation2()
        {
            Console.WriteLine("模板延迟实现2");
        }
    }

    class ConcreteClass2 : AbstractClass
    {
        public override void PrimitiveOpreation1()
        {
            Console.WriteLine("模板延迟实现3");
        }

        public override void PrimitiveOpreation2()
        {
            Console.WriteLine("模板延迟实现4");
        }
    }
}
